#ifndef QUEUE_H
#define QUEUE_H 1

#include <string>
#include "object.h"
#include "extras.h"

class Event{
private:
	Object* target;
	int delay;
	EventType type;
	AttrType attr;
	string msg;
	int value;
	unsigned int time_created;
	bool dead;
public:
	Event(Object* target_,int delay_,EventType type_,string msg_="");
	Event(Object* target_,int delay_,EventType type_,AttrType attr_,string msg_="",int value_=1);
	int TimeToExecute(){ return delay + time_created; }
	bool IsLessThan(Event* ptr);
	void Kill(Object* target_,EventType type_);
	void Execute();
};

struct node{
	Event* dataptr;
	node* prev,* next;
};

class Queue{
private:
	node* first;
	node* last;
	node* current;
public:
	Queue() : first(NULL),last(NULL),current(NULL){}
	void Add(Event* ptr);
	void AddToFront(Event* ptr);
	void Pop();
	void KillEvents(Object* target,EventType type);
};

#endif

